package com.usbconnecter;

import android.hardware.usb.UsbConstants;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint;

/**
 * Created by Administrator on 2016-12-15.
 */

public class PtpRequest {

    public int getDeviceInfo(UsbDeviceConnection connection, UsbEndpoint outEndpoint){
        return connection.controlTransfer(0xA1, 0x67, 0, 0, ConstantsUsb.GET_DEVICE_INFO, ConstantsUsb.GET_DEVICE_INFO.length, 1000);
//        return connection.bulkTransfer(outEndpoint, ConstantsUsb.GET_DEVICE_INFO, ConstantsUsb.GET_DEVICE_INFO.length, 3000);
    }


    public int openSession(UsbDeviceConnection connection, UsbEndpoint outEndpoint){
        return connection.controlTransfer(0xA1, 0x67, 0, 0, ConstantsUsb.OPEN_SESSION, ConstantsUsb.OPEN_SESSION.length, 1000);
//        return connection.bulkTransfer(outEndpoint, ConstantsUsb.GET_DEVICE_INFO, ConstantsUsb.GET_DEVICE_INFO.length, 3000);
    }



}
